Introduction to Shiny

Session - Introduction

Chris Beeley

Agenda - session one (about 2 hours)

Chapter overview

Introduction and getting started

What is Shiny?

——— Break ———–

What does it do?

Intro to reactivity

Application 1 - minimal (Your first application)
Application 2 - Sitrep (Situation Report)

Reactive expressions

(Optional)
NSE in Shiny applications
Bookmarks

——— Course end ———–

Agenda - session two (about 2 hours)

Chapter overview

——— Course end ———–

Agenda - session three (about 2 hours)

Chapter overview

——— Course end ———–

What is Shiny?

  • Shiny is a web application programming framework
  • The language of the web (HTML, JavaScript, and CSS) all called from R
  • It requires no knowledge of HTML, JavaScript, or CSS, but if you have that knowledge you can add more of these languages

Let’s create a shiny app - on a computer

  • Go to File > New Project... > New Directory
  • Select Shiny Application
  • Browse to the location you want the new folder to go to
  • Name your new project!

Projects

  • Using projects is a good habit to get into
  • Creating a specific project through the RStudio provides all the relevant documents needed

Let’s create a shiny app - in Posit Cloud

  • Go to File > New File > Shiny Web App...
  • Or use the short menu below File
  • Name your new project!

Posit Cloud workspaces are all projects!

  • Because the Cloud is a project it doesn’t need creating
  • What we do here you can also do on your own computer

Running the app

Screenshot of the RStudio pane under Tools and Help with the Run app icon and words

Changing the inputs (from the slider) changes the outputs (the chart)

More examples of Shiny

The Shiny Gallery which includes dashboards as well as parts (widgets) that can be added.

And from healthcare:

Screenshot of the Indices of Deprivation 2019 dashboard from Trafford Data lab

Mental Health Surge Model app

Screenshot of Mental Health Modelling app from The Strategy Unit used to estimate the impacts of COVID-19 on mental health services in England

Patient Feedback text mining app

Screenshot of Patient Text Mining app from Nottinghamshire Healthcare NHS Foundation Trust (via funding from NHS England)